import { ApiProperty } from '@nestjs/swagger';

import { IsDefined } from 'class-validator';

export class FileUploadDto {
  @ApiProperty({ type: 'string', format: 'binary', description: '文件' })
  @IsDefined()
  file: Express.Multer.File;
}

export class FileUploadChunkDto {
  @ApiProperty({ type: 'string', format: 'binary', description: '文件' })
  @IsDefined()
  chunk: Express.Multer.File;

  @ApiProperty({ type: 'string' })
  chunkHash: string;

  @ApiProperty({ type: 'string' })
  fileHash: string;
}

export class FileUploadChunkMergeDto {
  @ApiProperty({ type: 'string' })
  fileName: string;

  @ApiProperty({ type: 'string' })
  fileHash: string;

  @ApiProperty({ type: 'number' })
  fileSize: number;
}

export class FileUploadChunkCheckDto {
  @ApiProperty({ type: 'string' })
  fileName: string;

  @ApiProperty({ type: 'string' })
  fileHash: string;

  @ApiProperty({ type: 'number' })
  chunkTotal: number;
}

export class FileDownLoadChunkDto {
  @ApiProperty({ type: 'string' })
  filePath: string;

  @ApiProperty({ type: 'number' })
  start: number;

  @ApiProperty({ type: 'number' })
  end: number;
}
